package com.softeng.network.chess;

import java.awt.Color;
import java.awt.GridLayout;

import javax.swing.JPanel;

public class Square extends JPanel{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	Boolean hasPiece = false;
	
	public String pieceIdentifier; 
	
	public int location = 0;
	
	public int row; 
	
	public int col; 
	 
	
	//-----------------------------------------------------------------------------------------------
	
	Square(){
		
		//DEFAULT CONSTRUCTOR
		
	}
	
	//-----------------------------------------------------------------------------------------------
	
	Square(int location, JPanel panel){
		
		this.setLayout(new GridLayout());
		
		if (isEven(location))
			this.setBackground(Color.orange);
		else
			this.setBackground(Color.black);
		
		
		panel.add(this); 
		
	}
	
	//-----------------------------------------------------------------------------------------------
	
	Square(int row, int col, String pieceIdentifier){
		
		this.row = row;
		this.col = col; 
		
	}
	
	//-----------------------------------------------------------------------------------------------
	
	public Boolean isEven(int n){
		Boolean result; 
		
		
		if(n%2 == 0)
			result = true; 
		else
			result = false; 
		
		return result;
	}

}
